var ResSelect;//必须取得分辨率标签对象
var iDeviceIndex = 0;//设备的编号；   0：文档摄像头;1：人像摄像头
var iColorMode = 0;//设定获取的图像的色彩模式；   0: 彩色，1: 灰度，2: 黑白。
var Content;
var Capture;//必须得获取object对象 
var strFilePath = "D:\\DocImage\\";  //默认图片保存路径
var szPostfix = ".jpg"; //默认图片格式
var imgeId=0;
var strFileNames=new Array();
var count =0; //拍摄次数
var obj = {}; //存放右击选中的对象
var cacheImage = []; //该数组存放打印页面的图片
var cacheInfo = []; //该数组存放打印信息
var cacheContent = []; //该数组存放打印页面病案内容
var claName = ""; // 存放当前右击选中的元素
var images1 = "";
var images2 = "";
var images3 = "";
var images4 = "";
var printContent = ""; 
var msg = false; //记录当前病案是否登记成功

//打开设备
function printOpenDevice(value){
	$("#printCameroDialog").dialog({
		maximizable:true,
		closed: false,
		modal: true,
		title: "拍摄",
		buttons:[{
			text:"取消",
			iconCls:'',
			handler:function(){
				//$('#printCameroDialog').dialog("close");
				$(this).dialog('destroy');//销毁  
			},
		onClose:function(){
			$("#printMark").prop("data-attr","");
			$(this).dialog('destroy');//销毁  

		}
			
		}]
	});
	var iType = parseInt(value);
	iDeviceIndex = iType;
    if(Capture.OpenDevice(iDeviceIndex) == 0)
	{
    	//alert("启动高拍仪成功！")
		//WriteInfomation("启动设备"+iType.toString()+"成功");
		Capture.SetCameraExposure(iDeviceIndex,10);//设置自动曝光
		readFillInRes();
		var iW = Capture.GetResolutionWidth(iDeviceIndex, -1);
		var iH = Capture.GetResolutionHeight(iDeviceIndex, -1);
		var strRes = iW.toString() + '*' + iH.toString();
		for(var iDx = 0; iDx < ResSelect.length; iDx++)
		{
			if(strRes == ResSelect.options[iDx].text)
			{
				ResSelect.selectedIndex = iDx;
				break;
			}			
		}
	}
	else
	{
	//	alert("启动高拍仪失败！")
		//WriteInfomation("启动设备"+iType.toString()+"失败");
	}
    //SetFileType(0)		//保存图片格式
    SetCutPageType(1)	//自动切边
    PrintSetResIndex(4);		//设置固定分辨率
    $("#printShooting").css("display","");
    
}

//设置分辨率
function PrintSetResIndex(value){
	var iIndex = parseInt(value);
	var iW = Capture.GetResolutionWidth(iDeviceIndex, iIndex);
	var iH = Capture.GetResolutionHeight(iDeviceIndex, iIndex);
	if(Capture.SetResolutionByWH(iDeviceIndex, iW, iH) == 0)
	{
		WriteInfomation("设置分辨率成功,将重新打开设备");
	}
	else
	{
		WriteInfomation("设置分辨率失败");
	}
}

//切边类型
function SetCutPageType(value){
	var iType = parseInt(value);
	if(Capture.SetCutPageType(iDeviceIndex,iType) == 0){
		WriteInfomation("设置切边方式为"+iType);
	}
}


//去除阴影
function SetResuceShadow()
{
	if("PrintCheckReduceShadow".checked)
	{
		if(Capture.ReduceShadow(0) == 0)
		{
			WriteInfomation("开启去除阴影功能成功");
		}
		else
		{
			WriteInfomation("开启去除阴影功能失败");
		}
	}
	else
	{
		if(Capture.ReduceShadow(1) == 0)
		{
			WriteInfomation("关闭去除阴影功能成功");
		}
		else
		{
			WriteInfomation("关闭去除阴影功能失败");
		}		
	}
}

//拍摄
function PrintCaptureToFile() {
    var date = new Date();
    var imgName =  date.getFullYear().toString()
    		+(date.getMonth()+1).toString()
    		+date.getDate().toString()
    		+date.getHours().toString()
    		+date.getMinutes().toString()
    		+date.getSeconds().toString();
    
	if(iDeviceIndex == 2) {
		var strFileName = new Array();
		strFileName[0] = strFilePath + imgName + "-Combined" + szPostfix;
		var strDocFileName = strFilePath + imgName + "-SplitedDOC" + szPostfix;
		var strPorFileName = strFilePath + imgName + "-SplitedPOR" + szPostfix;
		strFileName[1] = strDocFileName + ";" + strPorFileName;
		
		for(var iDx = 0; iDx < 2; iDx++) {
			if(Capture.GrabToFile(strFileName[iDx]) == 0) {
				//alert("文件保存为当前目录下的"+strFileName[iDx]);
				if(iDx == 0)
				{
					if(PrintcheckMultiSource.checked)
					{
						Capture.ImagesToMultiPageFile(strFileName[iDx],0);
					}
					if(szPostfix != ".pdf" && szPostfix != ".tif")
					{
						strFileNames.push(strFileName[iDx]);
						Preview(0);
						//此测试页面只保存最后2次拍摄的文件名作为合并图像参数文件名	
						strMergeSource1 = strMergeSource2;
						strMergeSource2 = strFileName[iDx];
					}		
					var strBarcodeContent = "";
					if (checkBarcode.checked) 
					{    
						var iBarcodeCount = Capture.GetBarcodeCount();
						WriteInfomation("识别到"+iBarcodeCount.toString()+"个条码");
						for(var k = 0; k < iBarcodeCount; k++)
						{
							WriteInfomation("条码"+k.toString()+":["+Capture.GetBarcodeTypeName(k)+"]"+Capture.GetBarcodeContent(k));
							// strBarcodeContent += "[";
							// strBarcodeContent += Capture.GetBarcodeTypeName(k);
							// strBarcodeContent += "]";
							// strBarcodeContent += Capture.GetBarcodeContent(k);
						}
					// getBarcodeInfo(iBarcodeCount,strBarcodeContent);
					}
				}
				else
				{
					if(PrintcheckMultiSource.checked)
					{
						Capture.ImagesToMultiPageFile(strDocFileName,0);
						Capture.ImagesToMultiPageFile(strPorFileName,0);
					}
					if(szPostfix != ".pdf" && szPostfix != ".tif")
					{
						strFileNames.push(strDocFileName);
						Preview(0);
						strFileNames.push(strPorFileName);
						Preview(0);
						//此测试页面只保存最后2次拍摄的文件名作为合并图像参数文件名	
						strMergeSource1 = strDocFileName;
						strMergeSource2 = strPorFileName;
					}		
					var strBarcodeContent = "";
					if (checkBarcode.checked) 
					{    
						var iBarcodeCount = Capture.GetBarcodeCount();
						WriteInfomation("识别到"+iBarcodeCount.toString()+"个条码");
						for(var k = 0; k < iBarcodeCount; k++)
						{
							WriteInfomation("条码"+k.toString()+":["+Capture.GetBarcodeTypeName(k)+"]"+Capture.GetBarcodeContent(k));
							// strBarcodeContent += "[";
							// strBarcodeContent += Capture.GetBarcodeTypeName(k);
							// strBarcodeContent += "]";
							// strBarcodeContent += Capture.GetBarcodeContent(k);
						}
					// getBarcodeInfo(iBarcodeCount,strBarcodeContent);
					}
				}
			}
		}
		//imgeId++;
	} else {
		var strFileName;
		//拼接图片名
		strFileName = strFilePath + imgName + szPostfix;
		Capture.GrabToFile(strFileName); //创建图片
		//alert("文件保存为当前目录下的"+strFileName);
		//获取base64码
		var base64Code = Capture.GetBase64String();
		if(PrintcheckMultiSource.checked) {
			Capture.ImagesToMultiPageFile(strFileName,0);
		}
		//为true，则执行重拍操作
		if($("#printMark").prop("data-attr") == "true"){
			var base64 = Capture.GetBase64String(); //获取图片base64编码
			var src = "data:image/jpg;base64,"+base64+""; //拼接图片
			$(".print_event_style").find("img").prop("src",src);
		}else{
			if(szPostfix != ".pdf" && szPostfix != ".tif"){
				strFileNames.push(strFileName);
				//Preview(0);  //预览图片
				//此测试页面只保存最后2次拍摄的文件名作为合并图像参数文件名	
				//strMergeSource1 = strMergeSource2;
				//strMergeSource2 = strFileName;
				//预览图片
				var pic = document.getElementById("picture"+(count+1));
				if(count == 0){
					pic.src = "data:image/jpg;base64,"+base64Code+"";
					images1 = base64Code; 
					count++;
				}else if(count == 1){
					pic.src = "data:image/jpg;base64,"+base64Code+"";
					images2 = base64Code;
					count++;
				}else if(count == 2){
					pic.src = "data:image/jpg;base64,"+base64Code+"";
					images3 = base64Code;
					count++;
				}else if(count == 3){
					pic.src = "data:image/jpg;base64,"+base64Code+"";
					images4 = base64Code;
					count++;
				}else{
					//拍摄超过四张图片之后就重头开始替换之前拍摄的照片
					count = 0;
				}
				
			}		
		}
		var strBarcodeContent = "";
		
	}
    
}

/*//重拍
function repeatPicture(){
	判断当前是否IE8
	debugger;
	var base64 = Capture.GetBase64String();
	var agent = navigator.userAgent.toLowerCase();
	var cla = "";
	IE8 下执行的代码
	if(agent.substring(0,11) == "mozilla/4.0"){
		if(claName){
			var src = "data:image/jpg;base64,"+base64+"";
			$("."+claName+"").prop("src",src);
			obj = {};
			claName ="";
		}else{
			alert("照片不存在，请先拍摄!");
			return;
		}
	}else{
		if(obj.target.src == ""){
			alert("照片不存在，请先拍摄!");
			return;
		obj.target.src = "data:image/jpg;base64,"+base64+"";
		obj = {};
	}
	}
}*/


//形成预览图
function Preview(iValue){
	var iPreViewType = parseInt(iValue)
	if(strFileNames.length>6)
	{
		var pic1 = document.getElementById("picture1");
		var pic2 = document.getElementById("picture2");
		var pic3 = document.getElementById("picture2");
		var pic4 = document.getElementById("picture4");
		pic1.style.filter = pic2.style.filter;
		pic1.src = pic2.src;
		pic2.style.filter = pic3.style.filter;
		pic2.src = pic3.src;
		pic3.style.filter = pic4.style.filter;
		pic3.src = pic4.src;
		pic4.style.filter = pic5.style.filter;
		pic4.src = pic5.src;
//		for(var i=0;i<3;i++)
//		{
		if(iPreViewType == 0)
		{
			ShowPreview(strFileNames[strFileNames.length-1],3);
		}
		else
		{
			ShowPreviewBase64(strFileNames[strFileNames.length-1],3);
		}
//		}
		
	}else{
		if(iPreViewType == 0)
		{
			ShowPreview(strFileNames[strFileNames.length-1],strFileNames.length);
		}
		else
		{
			ShowPreviewBase64(strFileNames[strFileNames.length-1],strFileNames.length);
		}
//		}
	}
}
	
//读取分辨率列表
function readFillInRes(){	
	var iResVecLenth=ResSelect.options.length;
	var iResWidth=0;
	var iResHeight=0;
	for(var i=0;i<iResVecLenth;i++){
		ResSelect.options.remove(0);	//清除分辨率select选项内容
	}
	iResVecLenth = Capture.GetResolutionCount(iDeviceIndex);
	for(var i=0;i<iResVecLenth;i++){
		iResWidth = Capture.GetResolutionWidth(iDeviceIndex,i);
		iResHeight = Capture.GetResolutionHeight(iDeviceIndex,i);
		var strRes = iResWidth.toString()+'*'+iResHeight.toString();
		//var strRes = "1920"+'*'+"1080";			//设置固定分辨率值
		var resopp = new Option(strRes,i.toString());
		ResSelect.add(resopp);
	}
}

//摄像旋转
function PrintSetDeviceRotation(rotation){
    var nRotation = parseInt(rotation);
	if(nRotation%90 != 0){
		Capture.SetDeviceRotate(iDeviceIndex,0);//不能被90整除的默认不旋转
	}
    //alert(rotation);
    Capture.SetDeviceRotate(iDeviceIndex,nRotation);
}

//把相关信息写入操作记录编辑框中
function WriteInfomation(strInfo){
	Content.value += ("\r\n"+ strInfo);
}

function ShowPreviewBase64(strFileName,PreviewWinsowsNo) {
    var pic = document.getElementById("picture"+PreviewWinsowsNo);
	pic.src = 'data:image/gif;base64,' + strFileName;
}
//
function ShowPreview(strFileName,PreviewWinsowsNo) {
    var pic = document.getElementById("picture"+PreviewWinsowsNo);
    //var file = document.getElementById("f");
    var ext = strFileName.substring(strFileName.lastIndexOf(".")+1).toLowerCase();
     // gif在IE浏览器暂时无法显示
    if(ext!='png'&&ext!='jpg'&&ext!='bmp'&&ext!='tif'){
        alert("文件必须为图片！"); 
		return;
     }
     // IE浏览器
    if (document.all){
		//pic.src=strFileName;
		//pic.select();
		var reallocalpath = strFileName;
		var ie6 = /msie 6/i.test(navigator.userAgent);
		//IE6浏览器设置img的src为本地路径可以直接显示图片
		if (ie6){
			pic.src = reallocalpath; 
		}else{ 
			// 非IE6版本的IE由于安全问题直接设置img的src无法显示本地图片，但是可以通过滤镜来实现
			pic.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod='scale',src=\"" + reallocalpath + "\")";
			// 设置img的src为base64编码的透明图片 取消显示浏览器默认图片
			pic.src = '';
       }
	}

}


//是本人就隐藏
$("#IsSelf").combobox({
	onSelect:function(record){
		if(record.value == "0"){  
			$(".dlr").css("display","none");
		}else{
			$(".dlr").css("display","");
		}
	}
})
//登记操作
function register(){
	if(msg){
		$.messager.alert("提示","已做登记操作!","info");
		return;
	}
	var name = "";
	var address = "";  
	var IDCard =  "";
	var purpose = $("#printRegister_purpose").combobox("getValue");
	var relation =  $("#printRegister_relation").combobox("getValue");
	var phone = $("#printRegister_phone").textbox("getValue");
	var dlr = $(".dlr");
	if(!dlr.is(':hidden')){
		 name = $("#printRegister_fname").textbox("getValue");
		 address =  $("#printRegister_address").textbox("getValue");  
		 IDCard =  $("#printRegister_IDCard").textbox("getValue");
		if( name =="" ){
			$.messager.alert("提示","代理人名字不能为空!","info");
			return;
		}else if(address ==""){
			$.messager.alert("提示","代理人地址不能为空!","info");
			return;
		}else if(IDCard == ""){
			$.messager.alert("提示","代理人身份证不能为空!","info");
			return;
		}
	}
	if(phone != ""){
		if(regPhone(phone) == false){
			$.messager.alert("提示","非法格式，请重新输入!","info");
			return;
		}
	}
	if(purpose == ""){
	/* 	$.messager.alert("提示","打印目的不能为空!","info");
		return; */
	}else if(relation == ""){
		$.messager.alert("提示","与患者关系不能为空!","info");
		return;
	}
	var arr = [];
	var arrName = [];
	
	var contentName = "";
	//获取复印内容
	$(".print_td").find("input:checkbox[name='Model']:checked").each(function(){
		arr.push($(this).val());
		arrName.push($(this).siblings(".print_text").text());
	});
	printContent = arr.join(",");
	contentName = arrName.join(",");
	$.ajax({
		url: ctx + '/Print/RegisterPrint',
		dataType:'json',
		type:'post',
		data:{
			"fcydate" : $(".register_fcydate").text(),
			"purpose" : purpose,
			"purposeText" : $("#printRegister_purpose").combobox("getText"),
			"relationText" :$("#printRegister_relation").combobox("getText"),
			"relation" :relation,
			"IDCard" : IDCard,
			"printMan" : name,
			"address" : address,
			"fzyid" : $(".register_fzyid").text(),
			"fname" : $(".register_fname").text(),
			"content" : printContent
		},
		success:function(data){
			if(data == true){
				$.messager.alert("提示","登记成功!","info");
				msg = true;
				/*var fprn = $(".register_fprn").text();
				var fzyid = $(".register_fzyid").text();
				var fcydate = $(".register_fcydate").text();
				var frydate = $(".register_frydate").text();
				var fcybs = $(".register_fcybs").text();
				var fcydept = $(".register_fcydept").text();
				var fname = $(".register_fname").text();
				var ftimes = $(".register_ftimes").text();
				var fidcard = $(".register_fidcard").text();
				var url = ctx + "/Print/PrintScanning?fprn="+fprn+"&fzyid="+fzyid+"&fcydate="+fcydate+"&frydate="+frydate+"&fcybs="+fcybs
						+"&fcydept="+encodeURI(encodeURI(fcydept))+"&fname="+encodeURI(encodeURI(fname))+"&fidcard="+fidcard+"&content="+content+"&ftimes="+ftimes
						+"&dlrname="+encodeURI(encodeURI(name))+"&relation="+relation+"&dlridcard="+IDCard+"&contentName="+encodeURI(encodeURI(contentName));
				addTab("证件扫描", url, "", false);*/
				/*var tabPanel = $('#tabs');
				tabPanel.tabs('close',"打印登记");*/
			}else{
				$.messager.alert("提示","登记失败,请联系管理员！","info");
			}
		},
		error:function(){
			$.messager.alert("提示","登记失败,请联系管理员！","info");
		}
	});
}  	

//打印类型改变操作
$("#printRegister_type").combobox({
	onSelect:function(record){
		$("input[name=Model]").each(function(){
			$(this).prop("checked",false);
		});
		var typeVal = record.ffynrzjc;
		var arr = [];
		arr = typeVal.split(",");
		for (var i = 0; i < arr.length; i++) {
			$(".print_td").find("input:checkbox[value='"+arr[i]+"']").prop("checked",true);
			}
		}
	})
	
  //返回打印查询页面
  function returnQuery(){
	  var url = ctx + "/Print/PrintQuery";
	  addTab("打印登记查询", url,"", false);
	}
  
function connect() {
	clearForm();
	var CVR_IDCard = document.getElementById("plugin");
	var ret = CVR_IDCard.connect();
	document.all['ret'].innerHTML = ret;
	ret = JStrToObj(ret);
	DisplayInfo(ret);
	return;
}
//填充数据
function fillForm(ret) {
	DisplayInfo(ret);
	var pName = ret.resultContent.partyName;
	var pCardNo = ret.resultContent.certNumber;
	var pAddress=ret.resultContent.certAddress;
	 $("#printRegister_IDCard").textbox('setValue',pCardNo) //代理人身份证
	 $("#printRegister_fname").textbox('setValue',pName)//代理人姓名
	 $("#printRegister_address").textbox('setValue',pAddress)//代理人地址
}

function clearForm() {
	document.all['printRegister_IDCard'].value = '';
	document.all['printRegister_fname'].value = '';
	document.all['printRegister_address'].value = '';
}
//
function getStatus() {
	clearForm();
	var CVR_IDCard = document.getElementById("plugin");
	var ret = CVR_IDCard.getStatus();
	document.all['ret'].innerHTML = ret;
	ret = JStrToObj(ret);
	DisplayInfo(ret);
	return;
}

//初始化高拍仪
function init(){
	try{
		Content = document.getElementById("printContent");//获取文本框对象
		Capture = document.getElementById("printCapture");//根据js的脚本内容，必须先获取object对象
		ResSelect = document.getElementById("printResolution");//获取分辨率select标签的object对象
	}catch(err){
		alert("未找到ICaptureVideo.ocx控件，请重新安装!");
	}
}

 //键盘事件
$(document).keydown(function (event) {
	e = event ? event : (window.event ? window.event : null);
	if(e.keyCode ==113){ //F12 按键
		PrintCaptureToFile();
	}
});  
 
//读卡
function readCert() {
	connect();
	clearForm();
	var CVR_IDCard = document.getElementById("plugin");
	var ret = CVR_IDCard.readCert();
	document.all['ret'].innerHTML = ret;
	ret = JStrToObj(ret);
	if (ret.resultFlag == -1) {
		DisplayInfo(ret);
	} else {
		fillForm(ret);
	}
}

function disconnect() {
	clearForm();
	var CVR_IDCard = document.getElementById("plugin");
	var ret = CVR_IDCard.disconnect();
	document.all['ret'].innerHTML = ret;
	ret = JStrToObj(ret);
	DisplayInfo(ret);
	return;
}

function ReadIDCard() {
	var CVR_IDCard = document.getElementById("plugin");
	var ret = JStrToObj(CVR_IDCard.connect());

	if (ret.resultFlag == -1) {
		clearForm();
		DisplayInfo(ret);
		return;
	}

	ret = JStrToObj(CVR_IDCard.readCert());
	if (ret.resultFlag == -1) {
		clearForm();
	} else {
		DisplayInfo(ret);
		fillForm(ret);
	}

	ret = JStrToObj(CVR_IDCard.disconnect());
	if (ret.resultFlag == -1) {
		return;
		DisplayInfo(ret);
	}

}

function JStrToObj(str) {
	return eval("(" + str + ")");
}

function DisplayInfo(ret) {

}

//打开打印页面
function printPage(){
	//将信息放入缓存数组，以供打印页面填充数据
	debugger;
	if(images1){
		cacheImage.push(images1);
	}
	if(images2){
		cacheImage.push(images2);
	}
	if(images3){
		cacheImage.push(images3);
	}
	if(images4){
		cacheImage.push(images4);
	}
	cacheInfo.push($(".register_fname").text());
	cacheInfo.push($(".register_fidcard").text());
	cacheInfo.push($(".register_fcydept").text());
	cacheInfo.push($(".register_fcybs").text());
	cacheInfo.push($(".register_fprn").text());
	cacheInfo.push($(".register_frydate").text());
	cacheInfo.push($(".register_fcydate").text());
	cacheInfo.push($("#printRegister_relation").text());
	if($("#printRegister_fname").text() != ""){
		cacheInfo.push($("#printRegister_fname").text());
	}else if($("#printRegister_IDCard").text() != ""){
		cacheInfo.push($("#printRegister_IDCard").text());
	}
	//拆分打印内容
	var arr = [];
	//获取复印内容
	$(".print_td").find("input:checkbox[name='Model']:checked").each(function(){
		arr.push($(this).val());
	//	arrName.push($(this).siblings(".print_text").text());
	});
	printContent = arr.join(",");
	for (var i = 0; i < arr.length; i++) {
		cacheContent.push(arr[i]);
	}
	window.open("Print/PrintPage");
}

//打开收费对话框
function openChargeDialog(){
	$("#scanningCharge").dialog({
		maximizable:true,
		closed: false,
		modal: true,
		title: "打印收费",
		buttons:[{
			text:"保存",
			iconCls:'',
			handler:function(){
				var total = $("#ChargeTotal").text(); //总费用
				if(total == ""){
					$.messager.alert("info","请先计算出总费用在提交！","info");
					return;
				}
				var page = $("#printPage").numberbox("getValue"); //页数
				var copies = $("#printCopies").numberbox("getValue"); //份数
				var fzyid = $("#scanning_fzyid").text(); //住院ID
				$.ajax({
					url: ctx + '/Print/savePrintCharge',
					dataType:'json',
					type:'post',
					data:{
						"total" : total,
						"page" : page,
						"copies" : copies,
						"fzyid" : fzyid
					},
					success:function(data){
						if(data == true){
							$.messager.alert("info","操作成功！","info");
						}else{
							$.messager.alert("info","操作失败，请联系管理员！","info");
						}
					},
					error:function(){
						$.messager.alert("info","操作异常，请联系管理员！","info");
					}
				});
			}
		},{
			text:"取消",
			iconCls:'',
			handler:function(){
				 $("#singel").numberbox("setValue","");
				 $("#printPage").numberbox("setValue","");
				 $("#printCopies").numberbox("setValue","");
				 $("#ChargeTotal").html("");
				$('#scanningCharge').dialog("close");
				$("#printCamero").css("display","");
			}
		}]
	});
	$(".dFprn").html($(".register_fprn").text());
	$(".dFtimes").html($(".register_ftimes").text());
	$(".dFname").html($(".register_fname").text());
	$(".dFcydate").html($(".register_fcydate").text());
	$(".dFcydept").html($(".register_fcydept").text());
	//获取复印内容
	var arr = [];
	$(".print_td").find("input:checkbox[name='Model']:checked").each(function(){
		arr.push($(this).siblings(".print_text").text());
	});
	var html = "";
	for (var i = 0; i < arr.length; i++) {
		html += "<label>"+arr[i]+"</label>&nbsp;&nbsp;";
	}
	//$(".scanning_right").html(html);
}

//计算收费
$("#singel,#printPage,#printCopies").numberbox({
	onChange:function(oldValue,newValue){
		figure();			
	}
});

//计算公式
function figure(){
	var singel = $("#singel").numberbox("getValue");
	var page = $("#printPage").numberbox("getValue");
	var copies = $("#printCopies").numberbox("getValue");
	if(singel =="" || page =="" || copies ==""){
		return;
	}
	var total = "";
	total =parseInt(singel) * parseInt(page) * parseInt(copies);
	$("#ChargeTotal").html();
	$("#ChargeTotal").html(total);
}
	